import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/Purchase',
    name: 'Purchase',
    component: () => import('../views/Purchase.vue'),
    children:[
      {
        path: '/Purchase/Watches',
    name: 'Watches',
    component: () => import('../components/Purchase/Watches.vue'),
      },
      {
        path: '/Purchase/Trip',
    name: 'Trip',
    component: () => import('../components/Purchase/Trip.vue'),
      },
      {
        path: '/Purchase/Tide',
    name: 'Tide',
    component: () => import('../components/Purchase/Tide.vue'),
      },
      {
        path: '/Purchase/Recommend',
    name: 'Recommend',
    component: () => import('../components/Purchase/Recommend.vue'),
   
      },
      {
        path: '/Purchase/Packet',
    name: 'Packet',
    component: () => import('../components/Purchase/Packet.vue'),
      },
      {
        path: '/Purchase/Footwear',
    name: 'Footwear',
    component: () => import('../components/Purchase/Footwear.vue'),
      },
      {
        path: '/Purchase/Girl',
    name: 'Girl',
    component: () => import('../components/Purchase/Girl.vue'),
      },
      {
        //重定向
        path:"/Purchase",
        redirect:"/Purchase/Recommend"
      }
    ]
  },
  {
    path: '/Dewu',
    name: 'Dewu',
    component: () => import('../views/Dewu.vue')
  },
  {
    path: '/Me',
    name: 'Me',
    component: () => import('../views/Me.vue'),
    //路由独享守卫
    beforeEnter(to,from,next){
      console.log(to);
      console.log(from);
      if(localStorage.id==19992319552 || localStorage.password==19992319552){
        next()
      }else{
        next("/login")
      }
    
     
    }
  },
  {
    path: '/Serve',
    name: 'Serve',
    component: () => import('../views/Serve.vue'),
    //路由独享守卫
    beforeEnter(to,from,next){
      console.log(to);
      console.log(from);
      if(localStorage.id==19992319552 || localStorage.password==19992319552){
        next()
      }else{
        next("/login")
      }
    }
  },
  {
    path: '/Purchase/Input',
    name: 'Input',
    component: () => import('../components/input.vue')
  },
  {
    //重定向
    path:"/",
    redirect:"/Purchase"
  },
  {
    path:"/RPS",
    name:"RPS",
    component:() => import("../components/RPS.vue"),
    children:[
      {
        path: '/RP',
        name: 'RP',
        component: () => import('../components/Particulars/RP.vue'),
      },
      {
        path: '/Pj',
        name: 'Pj',
        component: () => import('../components/Particulars/Pj.vue'),
      },
      {
        path: '/OrderForm',
        name: 'OrderForm',
        component: () => import('../components/Particulars/OrderForm.vue'),
      },
      {
        path: '/site',
        name: 'site',
        component: () => import('../components/Particulars/site.vue'),
      },
      
      {
        path: '/dewuapp',
        name: 'dewuapp',
        component: () => import('../components/Particulars/dewuapp.vue'),
      },
      {
        path: '/login',
        name: 'login',
        component: () => import('../components/Particulars/login.vue'),
      },
      {
        path: '/classify',
        name: 'classify',
        component: () => import('../components/Particulars/classify.vue'),
      },
      {
        path: '/brand',
        name: 'brand',
        component: () => import('../components/Particulars/brand.vue'),
      },
      {
        path: '/brandF',
        name: 'brandF',
        component: () => import('../components/Particulars/brandF.vue'),
      },
      {
        path: '/register',
        name: 'register',
        component: () => import('../components/Particulars/register.vue'),
      },
    ]
  }
 
]

const router = new VueRouter({
  // mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
